src = '''\

# Some basic tests.
.pingpong
reset ss-entry s1-entry
>A
s1-A
>B
ss-B
>C
s1-C s1-exit s2-entry
>A
ss-A
>B
s2-B
>C
s2-C s2-exit s1-entry
'''
'''
#<comment>  : copy line to output
.<name>     : call smk_reset_<name>
              copy line to output
><event>    : call smk_process_<name>(EV_<event>)
              copy line to output
else        : ignore line.

'''

for s in src.splitlines():
    if not s:
        print 'PUTSTR("%s");' % s
    elif s.startswith('#'):
        print 'PUTSTR("%s");' % s
    elif s.startswith('.'):
        machine_name = s[1:].split()[0]
        print 'PUTSTR("%s");' % s
        print 'smk_reset_%s();' % machine_name
    elif s.startswith('>'):
        event_name = s[1:].split()[0]
        print 'PUTSTR("%s");' % s
        print 'smk_process_%s(SMK_EV_%s);' % (machine_name, event_name.upper())
        
        